package com.myspace.controller.account;

import com.myspace.service.space.account.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class LoginController {
    @Autowired
    private LoginService loginService;

    @PostMapping("user/account/token/")
    public Map<String, String> getToken(@RequestParam Map<String, String> data) {
        String username = data.get("username");
        String password = data.get("password");

        System.out.println(username + ' ' + password);
        return  loginService.getToken(username, password);
    }
}
